$(document).ready(function () {
	
	$(".message").click(function(event) {
		 $(".message").slideUp('slow');
	});
	
	
	var w1 = $("#line1").width();
	var w2 = $("#line2").width();
	var w3 = $("#line3").width();
	
	$("#line1").animate({left:0},800);
	$("#line2").delay(300).animate({left:0},800);
	$("#line3").delay(600).animate({left:0},800,function(){
		$('#subtext').text('|');
		typeIt();
	});
	
	var txt = $('#subtext').html();
	var timeOut;
	var txtLen = txt.length;
	var char = 0;
	$('#subtext').text('');
	
	function typeIt() {   
		var humanize = Math.round(Math.random() * (100));
		timeOut = setTimeout(function() {
			char++;
			var type = txt.substring(0, char);
			$('#subtext').html(type + '|');
			typeIt();
	
			if (char == txtLen) {
				$('#subtext').html($('#subtext').html().slice(0, -1)); // remove the '|'
				clearTimeout(timeOut);
			}
	
		}, humanize);
	}
	
});